#include "RenderGraphBuilder.h"

namespace Alice
{
    RDGBuilder::RDGBuilder(CGICommandListImmediate& inCGICommandList)
        :FRDGScopeState(&inCGICommandList),mExtendResourceLifetimeScope(inCGICommandList)
    {
        
    }
    void RDGBuilder::SetupDispatchPassExecute(){
        for (RDGDispatchPass* DispatchPass : mDispatchPasses)
		{
			//if (DispatchPass->bCulled)
			//{
			//	DispatchPass->CommandListsEvent.Trigger();
			//	continue;
			//}
			//IF_RDG_ENABLE_DEBUG(UserValidation.ValidateExecutePassBegin(DispatchPass));

			RDGDispatchPassBuilder DispatchPassBuilder(DispatchPass);
			DispatchPass->LaunchDispatchPassTasks(DispatchPassBuilder);
			DispatchPassBuilder.Finish();

			//IF_RDG_ENABLE_DEBUG(UserValidation.ValidateExecutePassEnd(DispatchPass));
		}
    }
    void RDGBuilder::Execute()
    {
        SetupDispatchPassExecute();
    }
}